.class public Lcom/opongo/android/custom/SpicyDealsActivity;
.super Lcom/opongo/blogapp/activities/AbstractViewPagerActivity;
.source "SpicyDealsActivity.java"


# static fields
.field public static final PREFS_NAME:Ljava/lang/String; = "BlogApp"

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private receiverPush:Landroid/content/BroadcastReceiver;

.field private settings:Landroid/content/SharedPreferences;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 29
    const-class v0, Lcom/opongo/android/custom/SpicyDealsActivity;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/opongo/android/custom/SpicyDealsActivity;->TAG:Ljava/lang/String;

    .line 27
    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 27
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/AbstractViewPagerActivity;-><init>()V

    return-void
.end method

.method static synthetic access$0(Lcom/opongo/android/custom/SpicyDealsActivity;I)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 27
    iput p1, p0, Lcom/opongo/android/custom/SpicyDealsActivity;->post_id:I

    return-void
.end method

.method static synthetic access$1()Ljava/lang/String;
    .locals 1

    .prologue
    .line 29
    sget-object v0, Lcom/opongo/android/custom/SpicyDealsActivity;->TAG:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$2(Lcom/opongo/android/custom/SpicyDealsActivity;)I
    .locals 1
    .parameter

    .prologue
    .line 27
    iget v0, p0, Lcom/opongo/android/custom/SpicyDealsActivity;->post_id:I

    return v0
.end method

.method static synthetic access$3()Landroid/support/v4/view/PagerAdapter;
    .locals 1

    .prologue
    .line 27
    sget-object v0, Lcom/opongo/android/custom/SpicyDealsActivity;->ADAPTER:Landroid/support/v4/view/PagerAdapter;

    return-object v0
.end method

.method static synthetic access$4(Lcom/opongo/android/custom/SpicyDealsActivity;)Landroid/content/SharedPreferences;
    .locals 1
    .parameter

    .prologue
    .line 30
    iget-object v0, p0, Lcom/opongo/android/custom/SpicyDealsActivity;->settings:Landroid/content/SharedPreferences;

    return-object v0
.end method


# virtual methods
.method public onContextItemSelected(Landroid/view/MenuItem;)Z
    .locals 1
    .parameter "item"

    .prologue
    .line 93
    const/4 v0, 0x1

    return v0
.end method

.method public onCreate(Landroid/os/Bundle;)V
    .locals 13
    .parameter "savedInstanceState"

    .prologue
    const/4 v12, 0x4

    const/4 v11, 0x3

    const/4 v10, 0x2

    const/4 v9, 0x1

    const/4 v3, 0x0

    .line 35
    invoke-super {p0, p1}, Lcom/opongo/blogapp/activities/AbstractViewPagerActivity;->onCreate(Landroid/os/Bundle;)V

    .line 37
    const v0, 0x7f030016

    invoke-virtual {p0, v0}, Lcom/opongo/android/custom/SpicyDealsActivity;->setContentView(I)V

    .line 39
    const-string v0, "BlogApp"

    invoke-virtual {p0, v0, v3}, Lcom/opongo/android/custom/SpicyDealsActivity;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/android/custom/SpicyDealsActivity;->settings:Landroid/content/SharedPreferences;

    .line 41
    new-instance v0, Lcom/opongo/blogapp/manager/DatabaseManager;

    const-string v1, "spicydeals"

    .line 42
    const-string v2, "INSERT INTO spicydeals (id,title,date,content,categories,commentscount,imageurl,post_order,guid,opened,newpost,did_vote,post_author,post_price,post_rating) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"

    invoke-direct {v0, p0, v1, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;-><init>(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V

    .line 41
    iput-object v0, p0, Lcom/opongo/android/custom/SpicyDealsActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    .line 44
    const-string v4, "SELECT deal.* FROM spicydeals AS deal INNER JOIN post_blogtype AS bt ON (deal.id = bt.post_id AND bt.blogtype_id = %d) ORDER BY %s ASC"

    .line 48
    .local v4, query:Ljava/lang/String;
    const/4 v0, 0x5

    new-array v5, v0, [Ljava/lang/String;

    const-string v0, "Alle"

    aput-object v0, v5, v3

    const-string v0, "Deals"

    aput-object v0, v5, v9

    const-string v0, "Gutscheine"

    aput-object v0, v5, v10

    const-string v0, "Kostenlos"

    aput-object v0, v5, v11

    const-string v0, "Lokales"

    aput-object v0, v5, v12

    .line 49
    .local v5, titles:[Ljava/lang/String;
    const/4 v0, 0x5

    new-array v6, v0, [Ljava/lang/String;

    const-string v0, "bt.post_order"

    aput-object v0, v6, v3

    const-string v0, "bt.post_order"

    aput-object v0, v6, v9

    const-string v0, "bt.post_order"

    aput-object v0, v6, v10

    const-string v0, "bt.post_order"

    aput-object v0, v6, v11

    const-string v0, "bt.post_order"

    aput-object v0, v6, v12

    .line 51
    .local v6, order:[Ljava/lang/String;
    new-instance v0, Lcom/opongo/android/custom/SpicyDealsViewPagerAdapter;

    iget-object v3, p0, Lcom/opongo/android/custom/SpicyDealsActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    move-object v1, p0

    move-object v2, p0

    invoke-direct/range {v0 .. v6}, Lcom/opongo/android/custom/SpicyDealsViewPagerAdapter;-><init>(Landroid/app/Activity;Landroid/content/Context;Lcom/opongo/blogapp/manager/DatabaseManager;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)V

    sput-object v0, Lcom/opongo/android/custom/SpicyDealsActivity;->ADAPTER:Landroid/support/v4/view/PagerAdapter;

    .line 53
    const v0, 0x7f080024

    invoke-virtual {p0, v0}, Lcom/opongo/android/custom/SpicyDealsActivity;->findViewById(I)Landroid/view/View;

    move-result-object v8

    check-cast v8, Landroid/support/v4/view/ViewPager;

    .line 54
    .local v8, pager:Landroid/support/v4/view/ViewPager;
    const v0, 0x7f080023

    invoke-virtual {p0, v0}, Lcom/opongo/android/custom/SpicyDealsActivity;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Lcom/viewpagerindicator/TitlePageIndicator;

    .line 55
    .local v7, indicator:Lcom/viewpagerindicator/TitlePageIndicator;
    sget-object v0, Lcom/opongo/android/custom/SpicyDealsActivity;->ADAPTER:Landroid/support/v4/view/PagerAdapter;

    invoke-virtual {v8, v0}, Landroid/support/v4/view/ViewPager;->setAdapter(Landroid/support/v4/view/PagerAdapter;)V

    .line 56
    invoke-virtual {v7, v8}, Lcom/viewpagerindicator/TitlePageIndicator;->setViewPager(Landroid/support/v4/view/ViewPager;)V

    .line 58
    new-instance v0, Lcom/opongo/android/custom/SpicyDealsActivity$1;

    invoke-direct {v0, p0}, Lcom/opongo/android/custom/SpicyDealsActivity$1;-><init>(Lcom/opongo/android/custom/SpicyDealsActivity;)V

    iput-object v0, p0, Lcom/opongo/android/custom/SpicyDealsActivity;->receiverPush:Landroid/content/BroadcastReceiver;

    .line 72
    iget-object v0, p0, Lcom/opongo/android/custom/SpicyDealsActivity;->receiverPush:Landroid/content/BroadcastReceiver;

    new-instance v1, Landroid/content/IntentFilter;

    .line 73
    const-string v2, "com.opongo.post_open_by_spicyDeal"

    invoke-direct {v1, v2}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    .line 72
    invoke-virtual {p0, v0, v1}, Lcom/opongo/android/custom/SpicyDealsActivity;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    .line 74
    return-void
.end method

.method public onCreateContextMenu(Landroid/view/ContextMenu;Landroid/view/View;Landroid/view/ContextMenu$ContextMenuInfo;)V
    .locals 0
    .parameter "menu"
    .parameter "view"
    .parameter "menuInfo"

    .prologue
    .line 79
    invoke-super {p0, p1, p2, p3}, Lcom/opongo/blogapp/activities/AbstractViewPagerActivity;->onCreateContextMenu(Landroid/view/ContextMenu;Landroid/view/View;Landroid/view/ContextMenu$ContextMenuInfo;)V

    .line 80
    return-void
.end method

.method public onCreateOptionsMenu(Landroid/view/Menu;)Z
    .locals 2
    .parameter "menu"

    .prologue
    .line 99
    invoke-virtual {p0}, Lcom/opongo/android/custom/SpicyDealsActivity;->getMenuInflater()Landroid/view/MenuInflater;

    move-result-object v0

    const v1, 0x7f0e0006

    invoke-virtual {v0, v1, p1}, Landroid/view/MenuInflater;->inflate(ILandroid/view/Menu;)V

    .line 102
    const/4 v0, 0x1

    return v0
.end method

.method public onDestroy()V
    .locals 1

    .prologue
    .line 176
    iget-object v0, p0, Lcom/opongo/android/custom/SpicyDealsActivity;->receiverPush:Landroid/content/BroadcastReceiver;

    invoke-virtual {p0, v0}, Lcom/opongo/android/custom/SpicyDealsActivity;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    .line 177
    iget-object v0, p0, Lcom/opongo/android/custom/SpicyDealsActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v0}, Lcom/opongo/blogapp/manager/DatabaseManager;->close()V

    .line 178
    invoke-super {p0}, Lcom/opongo/blogapp/activities/AbstractViewPagerActivity;->onDestroy()V

    .line 179
    return-void
.end method

.method public onOptionsItemSelected(Landroid/view/MenuItem;)Z
    .locals 5
    .parameter "item"

    .prologue
    const v3, 0x7f070050

    .line 121
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v2

    packed-switch v2, :pswitch_data_0

    .line 164
    :goto_0
    const/4 v2, 0x1

    return v2

    .line 123
    :pswitch_0
    new-instance v2, Landroid/app/AlertDialog$Builder;

    invoke-direct {v2, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    .line 124
    invoke-virtual {v2, v3}, Landroid/app/AlertDialog$Builder;->setTitle(I)Landroid/app/AlertDialog$Builder;

    move-result-object v2

    .line 125
    const/high16 v3, 0x7f0d

    new-instance v4, Lcom/opongo/android/custom/SpicyDealsActivity$2;

    invoke-direct {v4, p0}, Lcom/opongo/android/custom/SpicyDealsActivity$2;-><init>(Lcom/opongo/android/custom/SpicyDealsActivity;)V

    invoke-virtual {v2, v3, v4}, Landroid/app/AlertDialog$Builder;->setItems(ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    move-result-object v2

    .line 135
    invoke-virtual {v2}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;

    move-result-object v0

    .line 136
    .local v0, d:Landroid/app/Dialog;
    invoke-virtual {v0}, Landroid/app/Dialog;->show()V

    goto :goto_0

    .line 139
    .end local v0           #d:Landroid/app/Dialog;
    :pswitch_1
    new-instance v2, Landroid/app/AlertDialog$Builder;

    invoke-direct {v2, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    .line 140
    invoke-virtual {v2, v3}, Landroid/app/AlertDialog$Builder;->setTitle(I)Landroid/app/AlertDialog$Builder;

    move-result-object v2

    .line 141
    const v3, 0x7f0d0001

    new-instance v4, Lcom/opongo/android/custom/SpicyDealsActivity$3;

    invoke-direct {v4, p0}, Lcom/opongo/android/custom/SpicyDealsActivity$3;-><init>(Lcom/opongo/android/custom/SpicyDealsActivity;)V

    invoke-virtual {v2, v3, v4}, Landroid/app/AlertDialog$Builder;->setItems(ILandroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

    move-result-object v2

    .line 151
    invoke-virtual {v2}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;

    move-result-object v0

    .line 152
    .restart local v0       #d:Landroid/app/Dialog;
    invoke-virtual {v0}, Landroid/app/Dialog;->show()V

    goto :goto_0

    .line 155
    .end local v0           #d:Landroid/app/Dialog;
    :pswitch_2
    invoke-virtual {p0}, Lcom/opongo/android/custom/SpicyDealsActivity;->onSearchRequested()Z

    goto :goto_0

    .line 158
    :pswitch_3
    new-instance v1, Landroid/content/Intent;

    const-class v2, Lcom/opongo/android/custom/SpicyDealsAddActivity;

    invoke-direct {v1, p0, v2}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 159
    .local v1, intent:Landroid/content/Intent;
    invoke-virtual {p0, v1}, Lcom/opongo/android/custom/SpicyDealsActivity;->startActivity(Landroid/content/Intent;)V

    goto :goto_0

    .line 121
    :pswitch_data_0
    .packed-switch 0x7f080069
        :pswitch_3
        :pswitch_2
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

.method public onPrepareOptionsMenu(Landroid/view/Menu;)Z
    .locals 9
    .parameter "menu"

    .prologue
    const/4 v8, 0x0

    .line 106
    const v6, 0x7f08006b

    invoke-interface {p1, v6}, Landroid/view/Menu;->findItem(I)Landroid/view/MenuItem;

    move-result-object v2

    .line 107
    .local v2, itemOrder:Landroid/view/MenuItem;
    const v6, 0x7f08006c

    invoke-interface {p1, v6}, Landroid/view/Menu;->findItem(I)Landroid/view/MenuItem;

    move-result-object v1

    .line 109
    .local v1, itemDate:Landroid/view/MenuItem;
    invoke-virtual {p0}, Lcom/opongo/android/custom/SpicyDealsActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v6

    const/high16 v7, 0x7f0d

    invoke-virtual {v6, v7}, Landroid/content/res/Resources;->getStringArray(I)[Ljava/lang/String;

    move-result-object v4

    .line 110
    .local v4, itemsOrder:[Ljava/lang/String;
    iget-object v6, p0, Lcom/opongo/android/custom/SpicyDealsActivity;->settings:Landroid/content/SharedPreferences;

    const-string v7, "filterOrder"

    invoke-interface {v6, v7, v8}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I

    move-result v5

    .line 111
    .local v5, order:I
    new-instance v6, Ljava/lang/StringBuilder;

    const-string v7, "Sortierung: "

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    aget-object v7, v4, v5

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-interface {v2, v6}, Landroid/view/MenuItem;->setTitle(Ljava/lang/CharSequence;)Landroid/view/MenuItem;

    .line 113
    invoke-virtual {p0}, Lcom/opongo/android/custom/SpicyDealsActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v6

    const v7, 0x7f0d0001

    invoke-virtual {v6, v7}, Landroid/content/res/Resources;->getStringArray(I)[Ljava/lang/String;

    move-result-object v3

    .line 114
    .local v3, itemsDate:[Ljava/lang/String;
    iget-object v6, p0, Lcom/opongo/android/custom/SpicyDealsActivity;->settings:Landroid/content/SharedPreferences;

    const-string v7, "filterDate"

    invoke-interface {v6, v7, v8}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I

    move-result v0

    .line 115
    .local v0, date:I
    new-instance v6, Ljava/lang/StringBuilder;

    const-string v7, "Zeitraum: "

    invoke-direct {v6, v7}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    aget-object v7, v3, v0

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-interface {v1, v6}, Landroid/view/MenuItem;->setTitle(Ljava/lang/CharSequence;)Landroid/view/MenuItem;

    .line 117
    const/4 v6, 0x1

    return v6
.end method

.method public onSearchRequested()Z
    .locals 2

    .prologue
    const/4 v1, 0x0

    const/4 v0, 0x0

    .line 170
    invoke-virtual {p0, v1, v0, v1, v0}, Lcom/opongo/android/custom/SpicyDealsActivity;->startSearch(Ljava/lang/String;ZLandroid/os/Bundle;Z)V

    .line 171
    const/4 v0, 0x1

    return v0
.end method
